In semiconductor manufacturing, charged particle beams have been widely used to make high-precision masks. For example, mask makers (or “mask writers”) can use electron beams (“e-beams” or simply “beams”) to transfer design patterns onto masks (referred to as “mask patterns”). Software tools have been used to create and optimize the design patterns to fulfill design objectives. The mask patterns are transferred onto a substrate (e.g., a wafer) by a lithography process. The substrate with transferred patterns (referred to as “substrate patterns”) can be treated by following mechanical and chemical processes for manufacturing ICs. The design of the mask can significantly affect the quality of the resulting manufactured ICs. Therefore, it is desirable to produce mask patterns that eliminate (or, at least, significantly reduce) differences between the design patterns and the manufactured ICs.